package model;

import java.io.Serializable;
import javax.persistence.*;
import java.util.List;


/**
 * The persistent class for the CFOP database table.
 * 
 */
@Entity
@NamedQuery(name="Cfop.findAll", query="SELECT c FROM Cfop c")
public class Cfop implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@Column(name="ID_CFOP")
	private long idCfop;

	private String escricao;

	//bi-directional many-to-one association to Notafiscal
	@OneToMany(mappedBy="cfop")
	private List<Notafiscal> notafiscals;

	public Cfop() {
	}

	public long getIdCfop() {
		return this.idCfop;
	}

	public void setIdCfop(long idCfop) {
		this.idCfop = idCfop;
	}

	public String getEscricao() {
		return this.escricao;
	}

	public void setEscricao(String escricao) {
		this.escricao = escricao;
	}

	public List<Notafiscal> getNotafiscals() {
		return this.notafiscals;
	}

	public void setNotafiscals(List<Notafiscal> notafiscals) {
		this.notafiscals = notafiscals;
	}

	public Notafiscal addNotafiscal(Notafiscal notafiscal) {
		getNotafiscals().add(notafiscal);
		notafiscal.setCfop(this);

		return notafiscal;
	}

	public Notafiscal removeNotafiscal(Notafiscal notafiscal) {
		getNotafiscals().remove(notafiscal);
		notafiscal.setCfop(null);

		return notafiscal;
	}

}